﻿using Caliburn.Micro;
using JY.Wpf.Core.Enums;
using JY.Wpf.Core.Events;
using JY.Wpf.Core.ViewModelBases;
using JY.Wpf.Test.Views.MVVMDemoViews;
using SD.IOC.Core.Mediators;

namespace JY.Wpf.Test.ViewModels.MVVMDemoViewModels
{
    public class WarningMessageViewModel:ViewModelBase
    {
        #region # 变量

        #endregion

        #region # 构造器
        /// <summary>
        /// 构造器
        /// </summary>
        public WarningMessageViewModel()
        {
        }
        #endregion

        #region # 属性

        #endregion

        #region # Command方法
        #region # 成功消息——void Success()
        /// <summary>
        /// 成功消息
        /// </summary>
        public void Success()
        {
            this.EventAggregator.PublishOnUIThread(new WarningMessageEvent("成功消息", MessageType.Success));
        }
        #endregion

        #region # 警告消息——void Warning()
        /// <summary>
        /// 警告消息
        /// </summary>
        public void Warning()
        {
            this.EventAggregator.PublishOnUIThread(new WarningMessageEvent("警告消息", MessageType.Warning));
        }
        #endregion

        #region # 异常消息——void Error()
        /// <summary>
        /// 异常消息
        /// </summary>
        public void Error()
        {
            this.EventAggregator.PublishOnUIThread(new WarningMessageEvent("异常消息", MessageType.Error));
        }
        #endregion
        #endregion

        #region # 方法

        #endregion

        #region # 获取页面 —— object GetView(object context = null)
        /// <summary>
        /// 获取页面
        /// </summary>
        /// <param name="context">页面</param>
        /// <returns></returns>
        public override object GetView(object context = null)
        {
            return ResolveMediator.Resolve<WarningMessageView>();
        }
        #endregion
    }
}
